
//敏感词替换

public class Test3 {
    public static void main(String[] args) {
        //获取说的话
        String talk = "tmd，你在干嘛，sb";

        //设置敏感词库
        String[] arr = {"tmd","sb","cnm","md","mdzz"};

        //替换敏感词
        //循环将获取的话里的敏感词根据敏感词库替换掉
        for (int i = 0; i < arr.length; i++) {
            talk = talk.replace(arr[i],"***");
        }

        System.out.println(talk);
    }
}
